home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
DEMOS
/
3D_DEMO_4
/
!Demo4
/
h
/
GrpLib
< prev
Wrap
Text File
|
1992-02-06
|
5KB
|
152 lines
/******************************************************************************
* *
* grp.h *
* *
******************************************************************************/
/*-----------------------------------------------------------------------------
extern for CallGrp2
-----------------------------------------------------------------------------*/
extern void NormTrans(void);
extern void PtsTrans(void);
extern void PtsProj(void);
/*-----------------------------------------------------------------------------
extern Grp2D
-----------------------------------------------------------------------------*/
extern void Grp2DInit(void);
extern void Grp2DShutDown(void);
extern void Grp2DChgParm(void);
extern void Grp2DClearView(void);
extern void Grp2DSwapView(void);
extern void Uni2DPoly1(void);
extern void Uni2DPoly2(void);
extern void Uni2DPoly3(void);
extern void Uni2DPoly4(void);
extern void Uni2DCircle(void);
extern void Grd2DPoly3(void);
extern void Spr2DPoly3(void);
/*-----------------------------------------------------------------------------
extern Grp3D
-----------------------------------------------------------------------------*/
extern void Grp3DInit(void);
extern void Grp3DShutDown(void);
extern void Grp3DChgParm(void);
extern void Uni3DPoly1(void);
extern void Uni3DPoly2(void);
extern void Uni3DPoly3(void);
extern void Uni3DPoly4(void);
extern void Uni3DSphere(void);
extern void Grd3DPoly3(void);
extern void Spr3DPoly3(void);
extern void Spr3DLoad(void);
extern void Convexe3D(void);
extern void Convexe3DLoad(void);
extern void Schumkr3D(void);
extern void Schumkr3DLoad(void);
extern void (*Obj3DJmpTbl[])();
/*-----------------------------------------------------------------------------
extern Misc
-----------------------------------------------------------------------------*/
extern char TblCol[];
extern void InitRotMat(void);
extern void TransPtObs(void);
extern void TransNmObs(void);
extern void RotObjRep(void);
extern void RepToRepIn4Rep(void);
extern void CallGrp(void *GrpReg, void *GrpStack, void func(void));
extern void Call2Grp(void *GrpReg, void func(void));
/*-----------------------------------------------------------------------------
Matrix routines
-----------------------------------------------------------------------------*/
typedef int mat33[3][3];
typedef int vec3[3];
typedef int vec4[4];
#define MkVec3(A,x,y,z) (A)[0]=(x); (A)[1]=(y); (A)[2]=(z)
#define MkVec4(A,x,y,z,t) (A)[0]=(x); (A)[1]=(y); (A)[2]=(z); (A)[3]=(t)
#define MkRotMat(M,ra,rs,rt) GrpReg[0] = (ra) & 0x7FF; \
GrpReg[1] = (rs) & 0x7FF; \
GrpReg[2] = (rt) & 0x7FF; \
GrpReg[3] = (int)(M); \
CallGrp(GrpReg,GrpStack,InitRotMat)
#define Vec3to4(A,B) (B)[0]=(A)[0];(B)[1]=(A)[1];(B)[2]=(A)[2];\
(B)[3]=0
#define InvMat(A,B) /* A=1/B */ \
(A)[0][0]=(B)[0][0]; (A)[0][1]=(B)[1][0]; (A)[0][2]=(B)[2][0]; \
(A)[1][0]=(B)[0][1]; (A)[1][1]=(B)[1][1]; (A)[1][2]=(B)[2][1]; \
(A)[2][0]=(B)[0][2]; (A)[2][1]=(B)[1][2]; (A)[2][2]=(B)[2][2]
/*-----------------------------------------------------------------------------
Grp Level 1 routines prototypes
-----------------------------------------------------------------------------*/
extern int GrpReg[16];
extern int *GrpStack;
extern int *GrpGbuf;
extern void Change2DParm(int xorg, int yorg, int xmax, int ymax);
extern void Change3DParm(int pfx, int pfy, int dist);
extern void InitGrp(void);
extern void SwapView(int col);
/*-----------------------------------------------------------------------------
Grp Level 2 routines prototypes
-----------------------------------------------------------------------------*/
#define OBS 0
#define SPR 1
#define CVX 2
#define SCH 3
typedef struct {
int ra,rs,rt;
mat33 Rep;
vec3 Org;
int Prim[6];
} Object;
#define NBMAXDirecSrc 2
#define NBMAXPonctSrc 2
typedef struct {
int NbDirecSrc;
int NbPonctSrc;
int AmbLight;
vec4 DirecSrc[NBMAXDirecSrc];
vec4 PonctSrc[NBMAXPonctSrc];
} Envi;
extern Envi *MakeEnvi(int NbDirecSrc, int NbPonctSrc, int AmbLight);
extern char *load(char *Name);
extern void LoadObj(char *Name, int ObjType, int ObjNr);
extern Object *MakeObj(char *Name, int ObjType, int ObjNr);
extern void MoveObj(Object *obj, int ra, int rs, int rt, int v);
extern void PlaceObj(Object *obj, int ra, int rs, int rt, int x, int y, int z);
extern void ReadObjCoord(Object*obj,int*ra,int*rs,int*rt,int*x,int*y,int*z);
extern void PlotObj(Envi *envi, Object *obs, Object *obj);